cmake_minimum_required (VERSION 2.6)

project(levelserv)
SET(CMAKE_BUILD_TYPE "Release")

#
# Protobuf
#
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a;.so")
find_package(Protobuf REQUIRED)
PROTOBUF_GENERATE_CPP(PROTO_SRCS PROTO_HDRS leveldb_service.proto)
include_directories(${PROTOBUF_INCLUDE_DIR})

#
# Boost library.
#
set(Boost_USE_STATIC_LIBS ON)
FIND_PACKAGE(Boost COMPONENTS thread system REQUIRED)
INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIR})
ADD_DEFINITIONS( "-DHAS_BOOST" )

#
# lookup8
#
add_library(lookup8 lookup8.c)

#
# Example program.
#
include_directories("/usr/local/include/server1")
include_directories("/usr/local/include/google")
add_executable(leveldb_server leveldb_server.cc ${PROTO_SRCS} ${PROTO_HDRS})
target_link_libraries(leveldb_server
  libgflags.a
  libglog.a
  pthread
  libleveldb.a
  libserver1_base.a
  libserver1_server.a
  lookup8
  ${PROTOBUF_LIBRARY}
  ${Boost_LIBRARIES}
  )
add_executable(client client.cc ${PROTO_SRCS} ${PROTO_HDRS})
target_link_libraries(client
  libgflags.a
  libglog.a
  pthread
  libleveldb.a
  libserver1_base.a
  libserver1_server.a
  lookup8
  ${PROTOBUF_LIBRARY}
  ${Boost_LIBRARIES}
  )
